<?php
/*
 * model基类
 */
class Model extends DB {
    protected $db = null;
    //protected $fields = array();
    protected $tables = array();
    protected $check = null;
    protected $input = null;
    protected $limit = '';
    protected $viewFolder = '';
    protected function __construct() {
        $this->db = parent::getInstance();
        $this->input = Input::getInstance();
    }
    protected function add($addData) {
        return $this->db->add($this->tables,$addData);
    }
    protected function update(Array $param,Array $updateData) {
        return $this->db->update($this->tables,$param,$updateData);
    }

    protected function select(Array $fields,Array $param = array()) {
        return $this->db->select($this->tables,$fields,$param);
    }

    protected function login($fields,Array $param) {
        return $this->db->login($this->tables,$fields,$param);
    }

    protected function total($param = array()) {
        return $this->db->total($this->tables,$param);
    }
	protected function nextId() {
		return $this->db->nextId($this->tables);
	}
    public function isOne(Array $param) {
        return $this->db->isOne($this->tables,$param);
    }
    protected function del(Array $param) {
        return $this->db->del($this->tables,$param);
    }
    public function list_tables(){
        return $this->db->list_tables($this->tables);
    }
    public function setLimit($limit) {
        $this->limit = $limit;
    }
}